﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using proRFID_DiemDanh.Chung;


namespace proRFID_DiemDanh.PhongHoc
{
    public partial class ThemPhong : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
                txtTenPhong.Focus();
        }

        protected void cmdLuu_Click(object sender, ImageClickEventArgs e)
        {
            lbThongBao.Text = "";
            DataTable dt = new DataTable();
            dt = mdPhongHoc.PhongHoc_Insert(txtTenPhong.Text.Trim());
            if (dt.Rows[0]["ErrCode"].ToString() == "0")
            {
                mdMain.OKCancelBox(this, dt.Rows[0]["ErrMsg"].ToString() + "\\nBạn có muốn thêm dữ liệu nữa không?", "/PhongHoc/PhongHoc.aspx");
                txtTenPhong.Text = "";
                txtTenPhong.Focus();
            }
            else
                mdMain.OKBox(this, dt.Rows[0]["ErrMsg"].ToString(), "/PhongHoc/PhongHoc.aspx");
        }

    }
}